Fix dag_versions property when created_dag_version is None with bundle_version set#53952
Conversation
How does this happen? |
Ideally, this should not have happened as bundle_version and created_dag_version_id are both set as null if runs are migrated from 2.x. I noticed this behaviour in one of our env where we were getting this error. |
Backport failed to create: v3-0-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker 79e6fd3 v3-0-testThis should apply the commit to the v3-0-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continue |
|
Manual backport: #54010 |
…e_version set (apache#53952) Fix dag_versions property when created_dag_version is None with bundle_version set
…e_version set (apache#53952) Fix dag_versions property when created_dag_version is None with bundle_version set
…e_version set (apache#53952) (apache#54010) Fix dag_versions property when created_dag_version is None with bundle_version set (cherry picked from commit 79e6fd3)
This PR address issue when we have some run from Airflow2.x which have
bundle_version≠ NULL (Git bundle deployment configured) and created_dag_version_idcreated_dag_version_id= NULL (no dag version assigned during creation)This caused the
dag_versionsproperty to return[None]instead of an empty list:When Pydantic tries to serialize
[None], it fails validation because it expects DagVersion objects.Modified the
dag_versionsproperty to handle None values gracefully:Result:
"dag_versions": []Testing
test_dag_run_dag_versions_with_null_created_dag_versioncovers this exact scenariocloses: #52660
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.